package algorithm1_v2;

public class UpdateLeader {

	public static void update() {
		Integer min = 0;
		String minKey = null;
		SystemInfo info = SystemInfo.INSTANCE;
		for (String key : info.candidates.keySet()) {
			if (min == null || min.intValue() > info.recovered.get(key).intValue()) {
				min = info.recovered.get(key);
				minKey = key;
			}
		}

		info.leader.replace(0, info.leader.length(), minKey);
	}
}
